package com.example.liuling.test;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;

import com.tencent.bugly.crashreport.CrashReport;

import java.util.ArrayList;
import java.util.HashMap;

// 204,223,245,246,,275,276,279,280,298
//#204#223#245#279#280#298

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        CrashReport.initCrashReport(getApplicationContext(), "900013488", false);
        setContentView(R.layout.activity_main);
        findViewById(R.id.textview).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                sysload();
//                showPopupWindow(v);
//                LayoutInflater inflator = (LayoutInflater) getSystemService(
//                        LAYOUT_INFLATER_SERVICE);
//                View view = inflator.inflate(-1, null);
            }
        });

//        showPopupWindow(findViewById(R.id.textview));

    }

    private void showCustomDialog() {
        AlertDialog.Builder builder;
        AlertDialog dialog;
        LayoutInflater inflator = (LayoutInflater) this.getSystemService(
                LAYOUT_INFLATER_SERVICE);
        View view = inflator.inflate(R.layout.dialoglayout, null);
        builder = new AlertDialog.Builder(getApplicationContext());
        builder.setView(view);
        dialog = builder.create();
        dialog.show();
    }

    private void showPopupWindow(View view) {
        View contentView = LayoutInflater.from(this).inflate(
                R.layout.dialoglayout, null);
        contentView.findViewById(R.id.cancel).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        final PopupWindow popupWindow = new PopupWindow(contentView,
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
        popupWindow.setTouchable(true);
        popupWindow.showAsDropDown(view);
    }

    private void testHashMap() {
        HashMap map = new HashMap(1);
        map.put("1", 1);
        map.put("2", 2);
        map.get("1");
    }

    private void testArrayList() {
        ArrayList list = new ArrayList(3);
        list.get(10);
    }

    private void testInt() {
        Integer.parseInt("s1");
    }

    private void sysload() {
        System.load("com.lauren.HelloWorld");
    }

}
